//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension CognitoSync {
    // MARK: Enums

    public enum BulkPublishStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case failed = "FAILED"
        case inProgress = "IN_PROGRESS"
        case notStarted = "NOT_STARTED"
        case succeeded = "SUCCEEDED"
        public var description: String { return self.rawValue }
    }

    public enum Operation: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case remove = "remove"
        case replace = "replace"
        public var description: String { return self.rawValue }
    }

    public enum Platform: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case adm = "ADM"
        case apns = "APNS"
        case apnsSandbox = "APNS_SANDBOX"
        case gcm = "GCM"
        public var description: String { return self.rawValue }
    }

    public enum StreamingStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case disabled = "DISABLED"
        case enabled = "ENABLED"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct BulkPublishRequest: AWSEncodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String

        @inlinable
        public init(identityPoolId: String) {
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct BulkPublishResponse: AWSDecodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String?

        @inlinable
        public init(identityPoolId: String? = nil) {
            self.identityPoolId = identityPoolId
        }

        private enum CodingKeys: String, CodingKey {
            case identityPoolId = "IdentityPoolId"
        }
    }

    public struct CognitoStreams: AWSEncodableShape & AWSDecodableShape {
        /// The ARN of the role Amazon Cognito can assume in order to publish to the stream. This role must grant access to Amazon Cognito (cognito-sync) to invoke PutRecord on your Cognito stream.
        public let roleArn: String?
        /// Status of the Cognito streams. Valid values are: ENABLED - Streaming of updates to identity pool is enabled. DISABLED - Streaming of updates to identity pool is disabled. Bulk publish will also fail if StreamingStatus is DISABLED.
        public let streamingStatus: StreamingStatus?
        /// The name of the Cognito stream to receive updates. This stream must be in the developers account and in the same region as the identity pool.
        public let streamName: String?

        @inlinable
        public init(roleArn: String? = nil, streamingStatus: StreamingStatus? = nil, streamName: String? = nil) {
            self.roleArn = roleArn
            self.streamingStatus = streamingStatus
            self.streamName = streamName
        }

        public func validate(name: String) throws {
            try self.validate(self.roleArn, name: "roleArn", parent: name, max: 2048)
            try self.validate(self.roleArn, name: "roleArn", parent: name, min: 20)
            try self.validate(self.roleArn, name: "roleArn", parent: name, pattern: "^arn:aws:iam::\\d+:role/")
            try self.validate(self.streamName, name: "streamName", parent: name, max: 128)
            try self.validate(self.streamName, name: "streamName", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case roleArn = "RoleArn"
            case streamingStatus = "StreamingStatus"
            case streamName = "StreamName"
        }
    }

    public struct Dataset: AWSDecodableShape {
        /// Date on which the dataset was created.
        public let creationDate: Date?
        /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        public let datasetName: String?
        /// Total size in bytes of the records in this dataset.
        public let dataStorage: Int64?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String?
        /// The device that made the last change to this dataset.
        public let lastModifiedBy: String?
        /// Date when the dataset was last modified.
        public let lastModifiedDate: Date?
        /// Number of records in this dataset.
        public let numRecords: Int64?

        @inlinable
        public init(creationDate: Date? = nil, datasetName: String? = nil, dataStorage: Int64? = nil, identityId: String? = nil, lastModifiedBy: String? = nil, lastModifiedDate: Date? = nil, numRecords: Int64? = nil) {
            self.creationDate = creationDate
            self.datasetName = datasetName
            self.dataStorage = dataStorage
            self.identityId = identityId
            self.lastModifiedBy = lastModifiedBy
            self.lastModifiedDate = lastModifiedDate
            self.numRecords = numRecords
        }

        private enum CodingKeys: String, CodingKey {
            case creationDate = "CreationDate"
            case datasetName = "DatasetName"
            case dataStorage = "DataStorage"
            case identityId = "IdentityId"
            case lastModifiedBy = "LastModifiedBy"
            case lastModifiedDate = "LastModifiedDate"
            case numRecords = "NumRecords"
        }
    }

    public struct DeleteDatasetRequest: AWSEncodableShape {
        /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        public let datasetName: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String

        @inlinable
        public init(datasetName: String, identityId: String, identityPoolId: String) {
            self.datasetName = datasetName
            self.identityId = identityId
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.datasetName, key: "DatasetName")
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.datasetName, name: "datasetName", parent: name, max: 128)
            try self.validate(self.datasetName, name: "datasetName", parent: name, min: 1)
            try self.validate(self.datasetName, name: "datasetName", parent: name, pattern: "^[a-zA-Z0-9_.:-]+$")
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DeleteDatasetResponse: AWSDecodableShape {
        /// A collection of data for an identity pool. An identity pool can have multiple datasets. A dataset is per identity and can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.
        public let dataset: Dataset?

        @inlinable
        public init(dataset: Dataset? = nil) {
            self.dataset = dataset
        }

        private enum CodingKeys: String, CodingKey {
            case dataset = "Dataset"
        }
    }

    public struct DescribeDatasetRequest: AWSEncodableShape {
        /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        public let datasetName: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String

        @inlinable
        public init(datasetName: String, identityId: String, identityPoolId: String) {
            self.datasetName = datasetName
            self.identityId = identityId
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.datasetName, key: "DatasetName")
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.datasetName, name: "datasetName", parent: name, max: 128)
            try self.validate(self.datasetName, name: "datasetName", parent: name, min: 1)
            try self.validate(self.datasetName, name: "datasetName", parent: name, pattern: "^[a-zA-Z0-9_.:-]+$")
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeDatasetResponse: AWSDecodableShape {
        /// Meta data for a collection of data for an identity. An identity can have multiple datasets. A dataset can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.
        public let dataset: Dataset?

        @inlinable
        public init(dataset: Dataset? = nil) {
            self.dataset = dataset
        }

        private enum CodingKeys: String, CodingKey {
            case dataset = "Dataset"
        }
    }

    public struct DescribeIdentityPoolUsageRequest: AWSEncodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String

        @inlinable
        public init(identityPoolId: String) {
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeIdentityPoolUsageResponse: AWSDecodableShape {
        /// Information about the usage of the identity pool.
        public let identityPoolUsage: IdentityPoolUsage?

        @inlinable
        public init(identityPoolUsage: IdentityPoolUsage? = nil) {
            self.identityPoolUsage = identityPoolUsage
        }

        private enum CodingKeys: String, CodingKey {
            case identityPoolUsage = "IdentityPoolUsage"
        }
    }

    public struct DescribeIdentityUsageRequest: AWSEncodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String

        @inlinable
        public init(identityId: String, identityPoolId: String) {
            self.identityId = identityId
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeIdentityUsageResponse: AWSDecodableShape {
        /// Usage information for the identity.
        public let identityUsage: IdentityUsage?

        @inlinable
        public init(identityUsage: IdentityUsage? = nil) {
            self.identityUsage = identityUsage
        }

        private enum CodingKeys: String, CodingKey {
            case identityUsage = "IdentityUsage"
        }
    }

    public struct GetBulkPublishDetailsRequest: AWSEncodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String

        @inlinable
        public init(identityPoolId: String) {
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetBulkPublishDetailsResponse: AWSDecodableShape {
        /// If BulkPublishStatus is SUCCEEDED, the time the last bulk publish operation completed.
        public let bulkPublishCompleteTime: Date?
        /// The date/time at which the last bulk publish was initiated.
        public let bulkPublishStartTime: Date?
        /// Status of the last bulk publish operation, valid values are:  NOT_STARTED - No bulk publish has been requested for this identity pool IN_PROGRESS - Data is being published to the configured stream SUCCEEDED - All data for the identity pool has been published to the configured stream FAILED - Some portion of the data has failed to publish, check FailureMessage for the cause.
        public let bulkPublishStatus: BulkPublishStatus?
        /// If BulkPublishStatus is FAILED this field will contain the error message that caused the bulk publish to fail.
        public let failureMessage: String?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String?

        @inlinable
        public init(bulkPublishCompleteTime: Date? = nil, bulkPublishStartTime: Date? = nil, bulkPublishStatus: BulkPublishStatus? = nil, failureMessage: String? = nil, identityPoolId: String? = nil) {
            self.bulkPublishCompleteTime = bulkPublishCompleteTime
            self.bulkPublishStartTime = bulkPublishStartTime
            self.bulkPublishStatus = bulkPublishStatus
            self.failureMessage = failureMessage
            self.identityPoolId = identityPoolId
        }

        private enum CodingKeys: String, CodingKey {
            case bulkPublishCompleteTime = "BulkPublishCompleteTime"
            case bulkPublishStartTime = "BulkPublishStartTime"
            case bulkPublishStatus = "BulkPublishStatus"
            case failureMessage = "FailureMessage"
            case identityPoolId = "IdentityPoolId"
        }
    }

    public struct GetCognitoEventsRequest: AWSEncodableShape {
        /// The Cognito Identity Pool ID for the request
        public let identityPoolId: String

        @inlinable
        public init(identityPoolId: String) {
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetCognitoEventsResponse: AWSDecodableShape {
        /// The Cognito Events returned from the GetCognitoEvents request
        public let events: [String: String]?

        @inlinable
        public init(events: [String: String]? = nil) {
            self.events = events
        }

        private enum CodingKeys: String, CodingKey {
            case events = "Events"
        }
    }

    public struct GetIdentityPoolConfigurationRequest: AWSEncodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool for which to return a configuration.
        public let identityPoolId: String

        @inlinable
        public init(identityPoolId: String) {
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetIdentityPoolConfigurationResponse: AWSDecodableShape {
        /// Options to apply to this identity pool for Amazon Cognito streams.
        public let cognitoStreams: CognitoStreams?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.
        public let identityPoolId: String?
        /// Options to apply to this identity pool for push synchronization.
        public let pushSync: PushSync?

        @inlinable
        public init(cognitoStreams: CognitoStreams? = nil, identityPoolId: String? = nil, pushSync: PushSync? = nil) {
            self.cognitoStreams = cognitoStreams
            self.identityPoolId = identityPoolId
            self.pushSync = pushSync
        }

        private enum CodingKeys: String, CodingKey {
            case cognitoStreams = "CognitoStreams"
            case identityPoolId = "IdentityPoolId"
            case pushSync = "PushSync"
        }
    }

    public struct IdentityPoolUsage: AWSDecodableShape {
        /// Data storage information for the identity pool.
        public let dataStorage: Int64?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String?
        /// Date on which the identity pool was last modified.
        public let lastModifiedDate: Date?
        /// Number of sync sessions for the identity pool.
        public let syncSessionsCount: Int64?

        @inlinable
        public init(dataStorage: Int64? = nil, identityPoolId: String? = nil, lastModifiedDate: Date? = nil, syncSessionsCount: Int64? = nil) {
            self.dataStorage = dataStorage
            self.identityPoolId = identityPoolId
            self.lastModifiedDate = lastModifiedDate
            self.syncSessionsCount = syncSessionsCount
        }

        private enum CodingKeys: String, CodingKey {
            case dataStorage = "DataStorage"
            case identityPoolId = "IdentityPoolId"
            case lastModifiedDate = "LastModifiedDate"
            case syncSessionsCount = "SyncSessionsCount"
        }
    }

    public struct IdentityUsage: AWSDecodableShape {
        /// Number of datasets for the identity.
        public let datasetCount: Int?
        /// Total data storage for this identity.
        public let dataStorage: Int64?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String?
        /// Date on which the identity was last modified.
        public let lastModifiedDate: Date?

        @inlinable
        public init(datasetCount: Int? = nil, dataStorage: Int64? = nil, identityId: String? = nil, identityPoolId: String? = nil, lastModifiedDate: Date? = nil) {
            self.datasetCount = datasetCount
            self.dataStorage = dataStorage
            self.identityId = identityId
            self.identityPoolId = identityPoolId
            self.lastModifiedDate = lastModifiedDate
        }

        private enum CodingKeys: String, CodingKey {
            case datasetCount = "DatasetCount"
            case dataStorage = "DataStorage"
            case identityId = "IdentityId"
            case identityPoolId = "IdentityPoolId"
            case lastModifiedDate = "LastModifiedDate"
        }
    }

    public struct ListDatasetsRequest: AWSEncodableShape {
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String
        /// The maximum number of results to be returned.
        public let maxResults: Int?
        /// A pagination token for obtaining the next page of results.
        public let nextToken: String?

        @inlinable
        public init(identityId: String, identityPoolId: String, maxResults: Int? = nil, nextToken: String? = nil) {
            self.identityId = identityId
            self.identityPoolId = identityPoolId
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
            request.encodeQuery(self.maxResults, key: "maxResults")
            request.encodeQuery(self.nextToken, key: "nextToken")
        }

        public func validate(name: String) throws {
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListDatasetsResponse: AWSDecodableShape {
        /// Number of datasets returned.
        public let count: Int?
        /// A set of datasets.
        public let datasets: [Dataset]?
        /// A pagination token for obtaining the next page of results.
        public let nextToken: String?

        @inlinable
        public init(count: Int? = nil, datasets: [Dataset]? = nil, nextToken: String? = nil) {
            self.count = count
            self.datasets = datasets
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case count = "Count"
            case datasets = "Datasets"
            case nextToken = "NextToken"
        }
    }

    public struct ListIdentityPoolUsageRequest: AWSEncodableShape {
        /// The maximum number of results to be returned.
        public let maxResults: Int?
        /// A pagination token for obtaining the next page of results.
        public let nextToken: String?

        @inlinable
        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodeQuery(self.maxResults, key: "maxResults")
            request.encodeQuery(self.nextToken, key: "nextToken")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListIdentityPoolUsageResponse: AWSDecodableShape {
        /// Total number of identities for the identity pool.
        public let count: Int?
        /// Usage information for the identity pools.
        public let identityPoolUsages: [IdentityPoolUsage]?
        /// The maximum number of results to be returned.
        public let maxResults: Int?
        /// A pagination token for obtaining the next page of results.
        public let nextToken: String?

        @inlinable
        public init(count: Int? = nil, identityPoolUsages: [IdentityPoolUsage]? = nil, maxResults: Int? = nil, nextToken: String? = nil) {
            self.count = count
            self.identityPoolUsages = identityPoolUsages
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case count = "Count"
            case identityPoolUsages = "IdentityPoolUsages"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListRecordsRequest: AWSEncodableShape {
        /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        public let datasetName: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String
        /// The last server sync count for this record.
        public let lastSyncCount: Int64?
        /// The maximum number of results to be returned.
        public let maxResults: Int?
        /// A pagination token for obtaining the next page of results.
        public let nextToken: String?
        /// A token containing a session ID, identity ID, and expiration.
        public let syncSessionToken: String?

        @inlinable
        public init(datasetName: String, identityId: String, identityPoolId: String, lastSyncCount: Int64? = nil, maxResults: Int? = nil, nextToken: String? = nil, syncSessionToken: String? = nil) {
            self.datasetName = datasetName
            self.identityId = identityId
            self.identityPoolId = identityPoolId
            self.lastSyncCount = lastSyncCount
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.syncSessionToken = syncSessionToken
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.datasetName, key: "DatasetName")
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
            request.encodeQuery(self.lastSyncCount, key: "lastSyncCount")
            request.encodeQuery(self.maxResults, key: "maxResults")
            request.encodeQuery(self.nextToken, key: "nextToken")
            request.encodeQuery(self.syncSessionToken, key: "syncSessionToken")
        }

        public func validate(name: String) throws {
            try self.validate(self.datasetName, name: "datasetName", parent: name, max: 128)
            try self.validate(self.datasetName, name: "datasetName", parent: name, min: 1)
            try self.validate(self.datasetName, name: "datasetName", parent: name, pattern: "^[a-zA-Z0-9_.:-]+$")
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListRecordsResponse: AWSDecodableShape {
        /// Total number of records.
        public let count: Int?
        /// A boolean value specifying whether to delete the dataset locally.
        public let datasetDeletedAfterRequestedSyncCount: Bool?
        /// Indicates whether the dataset exists.
        public let datasetExists: Bool?
        /// Server sync count for this dataset.
        public let datasetSyncCount: Int64?
        /// The user/device that made the last change to this record.
        public let lastModifiedBy: String?
        /// Names of merged datasets.
        public let mergedDatasetNames: [String]?
        /// A pagination token for obtaining the next page of results.
        public let nextToken: String?
        /// A list of all records.
        public let records: [Record]?
        /// A token containing a session ID, identity ID, and expiration.
        public let syncSessionToken: String?

        @inlinable
        public init(count: Int? = nil, datasetDeletedAfterRequestedSyncCount: Bool? = nil, datasetExists: Bool? = nil, datasetSyncCount: Int64? = nil, lastModifiedBy: String? = nil, mergedDatasetNames: [String]? = nil, nextToken: String? = nil, records: [Record]? = nil, syncSessionToken: String? = nil) {
            self.count = count
            self.datasetDeletedAfterRequestedSyncCount = datasetDeletedAfterRequestedSyncCount
            self.datasetExists = datasetExists
            self.datasetSyncCount = datasetSyncCount
            self.lastModifiedBy = lastModifiedBy
            self.mergedDatasetNames = mergedDatasetNames
            self.nextToken = nextToken
            self.records = records
            self.syncSessionToken = syncSessionToken
        }

        private enum CodingKeys: String, CodingKey {
            case count = "Count"
            case datasetDeletedAfterRequestedSyncCount = "DatasetDeletedAfterRequestedSyncCount"
            case datasetExists = "DatasetExists"
            case datasetSyncCount = "DatasetSyncCount"
            case lastModifiedBy = "LastModifiedBy"
            case mergedDatasetNames = "MergedDatasetNames"
            case nextToken = "NextToken"
            case records = "Records"
            case syncSessionToken = "SyncSessionToken"
        }
    }

    public struct PushSync: AWSEncodableShape & AWSDecodableShape {
        /// List of SNS platform application ARNs that could be used by clients.
        public let applicationArns: [String]?
        /// A role configured to allow Cognito to call SNS on behalf of the developer.
        public let roleArn: String?

        @inlinable
        public init(applicationArns: [String]? = nil, roleArn: String? = nil) {
            self.applicationArns = applicationArns
            self.roleArn = roleArn
        }

        public func validate(name: String) throws {
            try self.applicationArns?.forEach {
                try validate($0, name: "applicationArns[]", parent: name, pattern: "^arn:aws:sns:[-0-9a-z]+:\\d+:app/[A-Z_]+/[a-zA-Z0-9_.-]+$")
            }
            try self.validate(self.roleArn, name: "roleArn", parent: name, max: 2048)
            try self.validate(self.roleArn, name: "roleArn", parent: name, min: 20)
            try self.validate(self.roleArn, name: "roleArn", parent: name, pattern: "^arn:aws:iam::\\d+:role/")
        }

        private enum CodingKeys: String, CodingKey {
            case applicationArns = "ApplicationArns"
            case roleArn = "RoleArn"
        }
    }

    public struct Record: AWSDecodableShape {
        /// The last modified date of the client device.
        public let deviceLastModifiedDate: Date?
        /// The key for the record.
        public let key: String?
        /// The user/device that made the last change to this record.
        public let lastModifiedBy: String?
        /// The date on which the record was last modified.
        public let lastModifiedDate: Date?
        /// The server sync count for this record.
        public let syncCount: Int64?
        /// The value for the record.
        public let value: String?

        @inlinable
        public init(deviceLastModifiedDate: Date? = nil, key: String? = nil, lastModifiedBy: String? = nil, lastModifiedDate: Date? = nil, syncCount: Int64? = nil, value: String? = nil) {
            self.deviceLastModifiedDate = deviceLastModifiedDate
            self.key = key
            self.lastModifiedBy = lastModifiedBy
            self.lastModifiedDate = lastModifiedDate
            self.syncCount = syncCount
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case deviceLastModifiedDate = "DeviceLastModifiedDate"
            case key = "Key"
            case lastModifiedBy = "LastModifiedBy"
            case lastModifiedDate = "LastModifiedDate"
            case syncCount = "SyncCount"
            case value = "Value"
        }
    }

    public struct RecordPatch: AWSEncodableShape {
        /// The last modified date of the client device.
        public let deviceLastModifiedDate: Date?
        /// The key associated with the record patch.
        public let key: String
        /// An operation, either replace or remove.
        public let op: Operation
        /// Last known server sync count for this record. Set to 0 if unknown.
        public let syncCount: Int64
        /// The value associated with the record patch.
        public let value: String?

        @inlinable
        public init(deviceLastModifiedDate: Date? = nil, key: String, op: Operation, syncCount: Int64, value: String? = nil) {
            self.deviceLastModifiedDate = deviceLastModifiedDate
            self.key = key
            self.op = op
            self.syncCount = syncCount
            self.value = value
        }

        public func validate(name: String) throws {
            try self.validate(self.key, name: "key", parent: name, max: 1024)
            try self.validate(self.key, name: "key", parent: name, min: 1)
            try self.validate(self.value, name: "value", parent: name, max: 1048575)
        }

        private enum CodingKeys: String, CodingKey {
            case deviceLastModifiedDate = "DeviceLastModifiedDate"
            case key = "Key"
            case op = "Op"
            case syncCount = "SyncCount"
            case value = "Value"
        }
    }

    public struct RegisterDeviceRequest: AWSEncodableShape {
        /// The unique ID for this identity.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. Here, the ID of the pool that the identity belongs to.
        public let identityPoolId: String
        /// The SNS platform type (e.g. GCM, SDM, APNS, APNS_SANDBOX).
        public let platform: Platform
        /// The push token.
        public let token: String

        @inlinable
        public init(identityId: String, identityPoolId: String, platform: Platform, token: String) {
            self.identityId = identityId
            self.identityPoolId = identityPoolId
            self.platform = platform
            self.token = token
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
            try container.encode(self.platform, forKey: .platform)
            try container.encode(self.token, forKey: .token)
        }

        public func validate(name: String) throws {
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case platform = "Platform"
            case token = "Token"
        }
    }

    public struct RegisterDeviceResponse: AWSDecodableShape {
        /// The unique ID generated for this device by Cognito.
        public let deviceId: String?

        @inlinable
        public init(deviceId: String? = nil) {
            self.deviceId = deviceId
        }

        private enum CodingKeys: String, CodingKey {
            case deviceId = "DeviceId"
        }
    }

    public struct SetCognitoEventsRequest: AWSEncodableShape {
        /// The events to configure
        public let events: [String: String]
        /// The Cognito Identity Pool to use when configuring Cognito Events
        public let identityPoolId: String

        @inlinable
        public init(events: [String: String], identityPoolId: String) {
            self.events = events
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encode(self.events, forKey: .events)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.events, name: "events", parent: name, max: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case events = "Events"
        }
    }

    public struct SetIdentityPoolConfigurationRequest: AWSEncodableShape {
        /// Options to apply to this identity pool for Amazon Cognito streams.
        public let cognitoStreams: CognitoStreams?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool to modify.
        public let identityPoolId: String
        /// Options to apply to this identity pool for push synchronization.
        public let pushSync: PushSync?

        @inlinable
        public init(cognitoStreams: CognitoStreams? = nil, identityPoolId: String, pushSync: PushSync? = nil) {
            self.cognitoStreams = cognitoStreams
            self.identityPoolId = identityPoolId
            self.pushSync = pushSync
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            try container.encodeIfPresent(self.cognitoStreams, forKey: .cognitoStreams)
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
            try container.encodeIfPresent(self.pushSync, forKey: .pushSync)
        }

        public func validate(name: String) throws {
            try self.cognitoStreams?.validate(name: "\(name).cognitoStreams")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.pushSync?.validate(name: "\(name).pushSync")
        }

        private enum CodingKeys: String, CodingKey {
            case cognitoStreams = "CognitoStreams"
            case pushSync = "PushSync"
        }
    }

    public struct SetIdentityPoolConfigurationResponse: AWSDecodableShape {
        /// Options to apply to this identity pool for Amazon Cognito streams.
        public let cognitoStreams: CognitoStreams?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.
        public let identityPoolId: String?
        /// Options to apply to this identity pool for push synchronization.
        public let pushSync: PushSync?

        @inlinable
        public init(cognitoStreams: CognitoStreams? = nil, identityPoolId: String? = nil, pushSync: PushSync? = nil) {
            self.cognitoStreams = cognitoStreams
            self.identityPoolId = identityPoolId
            self.pushSync = pushSync
        }

        private enum CodingKeys: String, CodingKey {
            case cognitoStreams = "CognitoStreams"
            case identityPoolId = "IdentityPoolId"
            case pushSync = "PushSync"
        }
    }

    public struct SubscribeToDatasetRequest: AWSEncodableShape {
        /// The name of the dataset to subcribe to.
        public let datasetName: String
        /// The unique ID generated for this device by Cognito.
        public let deviceId: String
        /// Unique ID for this identity.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.
        public let identityPoolId: String

        @inlinable
        public init(datasetName: String, deviceId: String, identityId: String, identityPoolId: String) {
            self.datasetName = datasetName
            self.deviceId = deviceId
            self.identityId = identityId
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.datasetName, key: "DatasetName")
            request.encodePath(self.deviceId, key: "DeviceId")
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.datasetName, name: "datasetName", parent: name, max: 128)
            try self.validate(self.datasetName, name: "datasetName", parent: name, min: 1)
            try self.validate(self.datasetName, name: "datasetName", parent: name, pattern: "^[a-zA-Z0-9_.:-]+$")
            try self.validate(self.deviceId, name: "deviceId", parent: name, max: 256)
            try self.validate(self.deviceId, name: "deviceId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct SubscribeToDatasetResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UnsubscribeFromDatasetRequest: AWSEncodableShape {
        /// The name of the dataset from which to unsubcribe.
        public let datasetName: String
        /// The unique ID generated for this device by Cognito.
        public let deviceId: String
        /// Unique ID for this identity.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which this identity belongs.
        public let identityPoolId: String

        @inlinable
        public init(datasetName: String, deviceId: String, identityId: String, identityPoolId: String) {
            self.datasetName = datasetName
            self.deviceId = deviceId
            self.identityId = identityId
            self.identityPoolId = identityPoolId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.datasetName, key: "DatasetName")
            request.encodePath(self.deviceId, key: "DeviceId")
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
        }

        public func validate(name: String) throws {
            try self.validate(self.datasetName, name: "datasetName", parent: name, max: 128)
            try self.validate(self.datasetName, name: "datasetName", parent: name, min: 1)
            try self.validate(self.datasetName, name: "datasetName", parent: name, pattern: "^[a-zA-Z0-9_.:-]+$")
            try self.validate(self.deviceId, name: "deviceId", parent: name, max: 256)
            try self.validate(self.deviceId, name: "deviceId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct UnsubscribeFromDatasetResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateRecordsRequest: AWSEncodableShape {
        /// Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
        public let clientContext: String?
        /// A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        public let datasetName: String
        /// The unique ID generated for this device by Cognito.
        public let deviceId: String?
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityId: String
        /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
        public let identityPoolId: String
        /// A list of patch operations.
        public let recordPatches: [RecordPatch]?
        /// The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.
        public let syncSessionToken: String

        @inlinable
        public init(clientContext: String? = nil, datasetName: String, deviceId: String? = nil, identityId: String, identityPoolId: String, recordPatches: [RecordPatch]? = nil, syncSessionToken: String) {
            self.clientContext = clientContext
            self.datasetName = datasetName
            self.deviceId = deviceId
            self.identityId = identityId
            self.identityPoolId = identityPoolId
            self.recordPatches = recordPatches
            self.syncSessionToken = syncSessionToken
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            request.encodeHeader(self.clientContext, key: "x-amz-Client-Context")
            request.encodePath(self.datasetName, key: "DatasetName")
            try container.encodeIfPresent(self.deviceId, forKey: .deviceId)
            request.encodePath(self.identityId, key: "IdentityId")
            request.encodePath(self.identityPoolId, key: "IdentityPoolId")
            try container.encodeIfPresent(self.recordPatches, forKey: .recordPatches)
            try container.encode(self.syncSessionToken, forKey: .syncSessionToken)
        }

        public func validate(name: String) throws {
            try self.validate(self.datasetName, name: "datasetName", parent: name, max: 128)
            try self.validate(self.datasetName, name: "datasetName", parent: name, min: 1)
            try self.validate(self.datasetName, name: "datasetName", parent: name, pattern: "^[a-zA-Z0-9_.:-]+$")
            try self.validate(self.deviceId, name: "deviceId", parent: name, max: 256)
            try self.validate(self.deviceId, name: "deviceId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, max: 55)
            try self.validate(self.identityId, name: "identityId", parent: name, min: 1)
            try self.validate(self.identityId, name: "identityId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, max: 55)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, min: 1)
            try self.validate(self.identityPoolId, name: "identityPoolId", parent: name, pattern: "^[\\w-]+:[0-9a-f-]+$")
            try self.recordPatches?.forEach {
                try $0.validate(name: "\(name).recordPatches[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case deviceId = "DeviceId"
            case recordPatches = "RecordPatches"
            case syncSessionToken = "SyncSessionToken"
        }
    }

    public struct UpdateRecordsResponse: AWSDecodableShape {
        /// A list of records that have been updated.
        public let records: [Record]?

        @inlinable
        public init(records: [Record]? = nil) {
            self.records = records
        }

        private enum CodingKeys: String, CodingKey {
            case records = "Records"
        }
    }
}

// MARK: - Errors

/// Error enum for CognitoSync
public struct CognitoSyncErrorType: AWSErrorType {
    enum Code: String {
        case alreadyStreamedException = "AlreadyStreamedException"
        case concurrentModificationException = "ConcurrentModificationException"
        case duplicateRequestException = "DuplicateRequestException"
        case internalErrorException = "InternalErrorException"
        case invalidConfigurationException = "InvalidConfigurationException"
        case invalidLambdaFunctionOutputException = "InvalidLambdaFunctionOutputException"
        case invalidParameterException = "InvalidParameterException"
        case lambdaThrottledException = "LambdaThrottledException"
        case limitExceededException = "LimitExceededException"
        case notAuthorizedException = "NotAuthorizedException"
        case resourceConflictException = "ResourceConflictException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case tooManyRequestsException = "TooManyRequestsException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize CognitoSync
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// An exception thrown when a bulk publish operation is requested less than 24 hours after a previous bulk publish operation completed successfully.
    public static var alreadyStreamedException: Self { .init(.alreadyStreamedException) }
    /// Thrown if there are parallel requests to modify a resource.
    public static var concurrentModificationException: Self { .init(.concurrentModificationException) }
    /// An exception thrown when there is an IN_PROGRESS bulk publish operation for the given identity pool.
    public static var duplicateRequestException: Self { .init(.duplicateRequestException) }
    /// Indicates an internal service error.
    public static var internalErrorException: Self { .init(.internalErrorException) }
    public static var invalidConfigurationException: Self { .init(.invalidConfigurationException) }
    /// The AWS Lambda function returned invalid output or an exception.
    public static var invalidLambdaFunctionOutputException: Self { .init(.invalidLambdaFunctionOutputException) }
    /// Thrown when a request parameter does not comply with the associated constraints.
    public static var invalidParameterException: Self { .init(.invalidParameterException) }
    /// AWS Lambda throttled your account, please contact AWS Support
    public static var lambdaThrottledException: Self { .init(.lambdaThrottledException) }
    /// Thrown when the limit on the number of objects or operations has been exceeded.
    public static var limitExceededException: Self { .init(.limitExceededException) }
    /// Thrown when a user is not authorized to access the requested resource.
    public static var notAuthorizedException: Self { .init(.notAuthorizedException) }
    /// Thrown if an update can't be applied because the resource was changed by another call and this would result in a conflict.
    public static var resourceConflictException: Self { .init(.resourceConflictException) }
    /// Thrown if the resource doesn't exist.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// Thrown if the request is throttled.
    public static var tooManyRequestsException: Self { .init(.tooManyRequestsException) }
}

extension CognitoSyncErrorType: Equatable {
    public static func == (lhs: CognitoSyncErrorType, rhs: CognitoSyncErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension CognitoSyncErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
